const Path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const webpack = require('webpack');
const WebpackConfig = {
    entry: {
        app: './src/app.js'
    },
    output: {
        path: Path.resolve(__dirname, './dist'),
        publicPath: '',
        filename: '[name].bundle-[hash:5].js'
    },
    devServer: {
        port: 6004,
        proxy: {
            '/admin': {
                target: 'http://localhost/rongshengda5',
                changeOrigin: true,
            }
        }
    },
    plugins: [
        new HtmlWebpackPlugin({
            filename: 'index.html',
            template: './index.html',
        }),
        new CleanWebpackPlugin(['./dist/*.js']),
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery'
        })
    ]
};

module.exports = WebpackConfig;